#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    QDialog* dialog = new QDialog(this);
    dialog->setWindowTitle("标题！");
    //设置大小
    dialog->resize(400, 500);
    dialog->show();
    //通过show方法就可以显示出对话框

    //关联delete和关闭按钮的点击信号
    dialog->setAttribute(Qt::WA_DeleteOnClose);
}
